#include <iostream>
#include <chrono>
#include "hcn.h"

using namespace std;
using namespace myHcn;

int main(int argc, const char *argv[]) 
{
    const char *modelFile("../hcn.onnx");
    Hcn pt = Hcn(modelFile);

    Ort::Value *out = pt.run(9);
    pt.printTensorValue(*out, "out9");

    out = pt.run(10);
    pt.printTensorValue(*out, "out10");

    out = pt.run(11);
    pt.printTensorValue(*out, "out11");

    // 一炮停止标志位
    pt.shotOverCallback();

    out = pt.run(9);
    pt.printTensorValue(*out, "out9");

    out = pt.run(10);
    pt.printTensorValue(*out, "out10");

    out = pt.run(11);
    pt.printTensorValue(*out, "out11");

    float itValue = 8;
    auto start = chrono::high_resolution_clock::now();
    for (int i=0; i<10000; ++i) {
        itValue += 0.0001;
        out = pt.run(itValue);
        // pt.printTensorValue(*out, "out2");
    }
    auto end = chrono::high_resolution_clock::now();
    chrono::duration<double> elapsed = end - start;
    cout << "Elapsed time: " << elapsed.count() << " seconds" << endl;

    cout << "while true" << endl;
    itValue = 8;
    while (true)
    {
        itValue += 0.00001;
        out = pt.run(itValue);
        if (itValue >= 100) itValue=8;
        /* code */
    }
    

    // 一炮停止标志位
    pt.shotOverCallback();

    return 0;
}